//
//  WXDOMDebuggerDomain.h
//  PonyDebuggerDerivedSources
//
//  Generated on 8/23/12
//
//  Licensed to Square, Inc. under one or more contributor license agreements.
//  See the LICENSE file distributed with this work for the terms under
//  which Square, Inc. licenses this file to you.
//

#import "WXObject.h"
#import "WXDebugger.h"
#import "WXDynamicDebuggerDomain.h"


@protocol WXDOMDebuggerCommandDelegate;

// DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.
@interface WXDOMDebuggerDomain : WXDynamicDebuggerDomain 

@property (nonatomic, assign) id <WXDOMDebuggerCommandDelegate, WXCommandDelegate> delegate;

@end

@protocol WXDOMDebuggerCommandDelegate <WXCommandDelegate>
@optional

// Sets breakpoint on particular operation with DOM.
// Param nodeId: Identifier of the node to set breakpoint on.
// Param type: Type of the operation to stop upon.
- (void)domain:(WXDOMDebuggerDomain *)domain setDOMBreakpointWithNodeId:(NSNumber *)nodeId type:(NSString *)type callback:(void (^)(id error))callback;

// Removes DOM breakpoint that was set using <code>setDOMBreakpoint</code>.
// Param nodeId: Identifier of the node to remove breakpoint from.
// Param type: Type of the breakpoint to remove.
- (void)domain:(WXDOMDebuggerDomain *)domain removeDOMBreakpointWithNodeId:(NSNumber *)nodeId type:(NSString *)type callback:(void (^)(id error))callback;

// Sets breakpoint on particular DOM event.
// Param eventName: DOM Event name to stop on (any DOM event will do).
- (void)domain:(WXDOMDebuggerDomain *)domain setEventListenerBreakpointWithEventName:(NSString *)eventName callback:(void (^)(id error))callback;

// Removes breakpoint on particular DOM event.
// Param eventName: Event name.
- (void)domain:(WXDOMDebuggerDomain *)domain removeEventListenerBreakpointWithEventName:(NSString *)eventName callback:(void (^)(id error))callback;

// Sets breakpoint on particular native event.
// Param eventName: Instrumentation name to stop on.
- (void)domain:(WXDOMDebuggerDomain *)domain setInstrumentationBreakpointWithEventName:(NSString *)eventName callback:(void (^)(id error))callback;

// Sets breakpoint on particular native event.
// Param eventName: Instrumentation name to stop on.
- (void)domain:(WXDOMDebuggerDomain *)domain removeInstrumentationBreakpointWithEventName:(NSString *)eventName callback:(void (^)(id error))callback;

// Sets breakpoint on XMLHttpRequest.
// Param url: Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
- (void)domain:(WXDOMDebuggerDomain *)domain setXHRBreakpointWithUrl:(NSString *)url callback:(void (^)(id error))callback;

// Removes breakpoint from XMLHttpRequest.
// Param url: Resource URL substring.
- (void)domain:(WXDOMDebuggerDomain *)domain removeXHRBreakpointWithUrl:(NSString *)url callback:(void (^)(id error))callback;

@end

@interface WXDebugger (WXDOMDebuggerDomain)

@property (nonatomic, readonly, strong) WXDOMDebuggerDomain *DOMDebuggerDomain;

@end
